<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="vue.global.js"></script>
</head>
<body>
<div id = 'app'>
    123,{{message}}
</div>
<script>
    const app = Vue.createApp({
        data() {
            return {
                message: 'hello world'
            }
        },
        //初始化实例时触发start
        beforeCreate() {
            console.log('beforeCreate');
            console.log('beforeCreate:'+app.innerHTML);

        },
        created(){
            console.log('created');
            console.log('created:'+app.innerHTML);
        },
        onMounted(){
            console.log('onMounted');
            console.log('onMounted:'+app.innerHTML);
        },
        mounted(){
            console.log('mounted');
            console.log('mounted:'+app.innerHTML);
        },
        //初始化实例时触发end

        //更新数据时触发start
        beforeUpdate(){
            console.log('beforeUpdate');
            console.log(this.message);
            console.log('beforeUpdate:'+this.message);
        },
        updated(){
            console.log('updated');
            console.log('updated:'+this.message);
        },
        //更新数据时触发end

        //卸载实例后触发start
        beforeUnmount() {
            console.log('beforeUnmount');
            console.log('beforeUnmount:'+this.message);
        },
        unmounted() {
            console.log('unmounted');
            console.log('unmounted:'+this.message);
        },
        //卸载实例后触发end

    });
    let vm = app.mount('#app');

    setTimeout(()=>{
        vm.message = 'hi vue';
    },2000)
</script>
</body>
</html>